package edu.bmstu.rslab;

import javax.swing.*;
import java.awt.event.ActionEvent;

/**
 * Created by Chikh (using IntelliJ IDEA).
* Date: 15.05.2009
* Time: 15:42:21
*/
class startAction extends AbstractAction {
    private final Action positioningAction;
    private final Timer positioningTimer;
    private final Timer movingTimer;

    public startAction(Action positioningAction, Timer positioningTimer, Timer movingTimer) {
        super("Start");
        this.positioningAction = positioningAction;
        this.positioningTimer = positioningTimer;
        this.movingTimer = movingTimer;
        setEnabled(false);
    }

    public void actionPerformed(ActionEvent e) {
        setEnabled(false);
        positioningAction.actionPerformed(null);
        positioningTimer.start();
        movingTimer.start();
    }
}
